package com.stone.design.patterns.strategy;

/**
 * @author Stone
 * @version V1.0
 * @description: 一个鸭子类 具有飞行的行为和叫的行为
 * @date 18/4/2 21:32
 * @email redsstone@163.com
 */
public abstract class Duck {
    protected FlyBehavior mFlyBehavior;
    protected QuackBehavior mQuackBehavior;

    // 指示鸭头的颜色
    abstract void display();

    public void performQuack() {
        mQuackBehavior.quack();
    }

    public void performFly() {
        mFlyBehavior.fly();
    }


    public void setFlyBehavior(FlyBehavior flyBehavior) {
        mFlyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        mQuackBehavior = quackBehavior;
    }
}
